package com.wfy.orchestra.dispatch

import com.wfy.orchestra.monitor.PerformanceMonitor

/**
 * @author : wangfengyuan
 * e-mail  : 446950883@qq.com
 * time    : 2025/3/20
 * desc    :
 * version : 1.0
 */
interface ITaskGraph {
    fun addTask(task: ITask) //添加任务到图中
    fun addTask(vararg tasks: ITask)

    fun addDependency(taskId: String, dependencyId: String) //添加任务依赖关系
    fun addDependency(taskId: String, dependencyIds: List<String>)
    fun configureDependencies(block: TaskDslBuilder.() -> Unit) = Unit

    fun start() //初始化优先级队列，启动调度线程
    fun cancelAll() //取消方法

    fun setOnErrorListener(listener: OnErrorListener) //task运行时错误监听
    fun setPerformanceMonitor(monitor: PerformanceMonitor) //task运行性能和调度性能监听

    fun generateDotGraph(): String //依赖可视化,生成DAG的Graphviz描述
    fun updatePriority(taskId: String, newPriority: Int) //动态修改优先级
}